package com.sense.kukoo.common.repo.kv.login_history

import com.sense.kukoo.common.repo.kv.KukooKeyValueManager
import com.tencent.mmkv.MMKV

class LoginHistoryImpl(val mmkv: MMKV) : LoginHistory {

    private var loginType: Int

    init {
        loginType = mmkv.decodeInt(KukooKeyValueManager.KEY_LOGIN_TYPE, LoginHistory.NO_HISTORY)
    }

    override fun setLoginType(type: Int) {
        loginType = type
        mmkv.encode(KukooKeyValueManager.KEY_LOGIN_TYPE, loginType)
    }

    override fun lastLoginType(): Int = loginType
}